/**
 * CS543 HW4 Joseph Meyer
 */
package edu.src.hardware;

/**
 * One frame of the baking store
 * each frame holds 256 bytes
 * 
 * @author meyer
 *
 */
public class BackingFrame {

	byte[] bytesInFrame;
	
	/**
	 * Default constructor
	 * @param array - must be 0 - 255
	 * @throws Exception 
	 */
	public BackingFrame(byte[] array) throws Exception {
		
		if (array.length != 256) {
			throw new Exception("BackingFrame arrays must be 255 bytes");
		}
		bytesInFrame = array;
	}
	
	
	/**
	 * The offset is 0 based
	 * @param offset int.
	 * @return byte - value at the given offset
	 */
	public byte getByteAtOffset(int offset) {
		return bytesInFrame[offset];
	}
	
	/**
	 * The offset is 0 based
	 * @param offset int.
	 * @param value - byte.value at the given offset
	 */
	public void setByteAtOffset(int offset, byte value) {
		bytesInFrame[offset] = value;
	}

}
